<template>
 <view class="main">
   <view class="part1">
	 我的分享
	 <view class="p-2" @click="sycx">【收益查询】</view>
   </view> 
   <view class="pp1">
	 <view class="pp2">
		<view class="pp3">
		  <view class="pp4">
			  <view class="pp5">
				  <view class="pp6">
					  <view class="pp7">
						 <view class="pp7-1">
							 <view class="pbtn btn1" @click="share1()">引荐客户</view>
							 <view class="pbtn btn2 cur">引荐拍手</view>
						 </view>
					  </view>
					  <view class="pm1" style="height:50rpx;">
					  	<view class="pm1-1">分享类型</view>  
					  </view> 
					   
					   <view class="labellist">
					     <view class="label" :class="{ tcur: type==0 }" @click="showtype(0)">全部</view>
					   	<view v-for="(item,index) in pitem" class="label" :class="{ tcur: type==item.id }" @click="showtype(item.id)">{{item.val}}</view>
					   </view>
					  <view class="pm1">
						<view class="pm1-1">分享链接</view> 
						<view class="pm1-2">点击右边的分享按钮，转发给微信好友</view>
						 <button class="w100 h100 btn-collection inline-block"  open-type="share">
						  <image src="https://ppp.new.zeroitem.cn/ppp/fx1.png" style="width:64rpx;height:64rpx"></image> 
						 </button>
					  </view>
					  <view class="pm2">
						<view class="pm1-1">或二维码</view>
						<image class="pm2-2" :src="wximg" @click="preview()"></image>
					  </view>
					  <view class="pm3">一次注册，终身绑定，收益总像偶然中的必然</view>
				  </view>
				<view class="pstxt mp1">引荐客户下单</view>
				<view class="pstxt1">奖励25%订单金额抵用券</view>
			  </view>
			  <view class="pstxt mp2">引荐客户二次下单</view>
			  <view class="pstxt1">奖励20%订单金额抵用券</view>
		  </view>
		     <view class="pstxt mp3">引荐客户三次下单</view>
		     <view class="pstxt1">奖励15%订单金额抵用券</view>
		</view> 
           <view class="pstxt mp4">引荐客户四次以上下单</view>
		   <view class="pstxt1">奖励5%订单金额抵用券</view>
	 </view>  
   </view>
   
 </view>
</template>

<script>
	import {
		mapGetters,
		mapActions
	} from 'vuex'
	import {
	   getcode,plable
	} from '@/api/ppp'
	import {
		getUser
	} from '@/api/user';
	const app = getApp()
	export default {
	    data() {
	        return {
			 wximg:"",
			 userInfo:[],
			 pitem:[],
			 type:0
	        }
	    },
		onShow(){
         this.getwxcode();
		 this.getUserInfoFun();
		 this.showpitem();
		},
        onShareAppMessage(res) {
			var sn=this.userInfo.sn;
			var type=this.type;
		    return {
		      title: '片拍拍，拍出好生活',
		      path: '/pages/ppp/index/drps?sn='+sn+"&impstr="+type
		    }
		},		
	    methods: {
		share1(){
		  uni.redirectTo({
		  	 url:"/pages/ppp/my/share"
		  }) 
		},
		sycx(){
			uni.redirectTo({
				 url:"/pages/user_bill/user_bill?type=2"
			}) 	
		},
		 async getwxcode(){
		  var type=this.type;
		  const{
		     data
		   }= await getcode({type:type});	 
		   this.wximg=data;
		 },
		 async showtype(type){
		   this.type=type;
		 			const{
		 			   data
		 			 }= await getcode({type:type});	 
		 			 this.wximg=data;	
		 },
		 async showpitem(){
		   const{
		    code,
		    msg,
		    data
		   }= await plable();
		   if(code==1){
		   	this.pitem=data;
		   }	 
		 },	
		 async getUserInfoFun() {
		 	const {
		 		data,
		 		code
		 	} = await getUser()
		 	if (code == 1) {
		 		this.userInfo = data
		 	} 
		 },
		 preview(){
			uni.previewImage({
				current:0,
				urls:[this.wximg]
			})  
		  }
	    },
		computed: {
			...mapGetters(['isLogin', ]),
		}		
		
	}
</script>

<style>
  @import "./share1.css";	
</style>
